package com.max.eshop.comporators;

import java.util.Comparator;
import com.max.eshop.core.Book;

public class SortedBooksByDateOfReceipt implements Comparator<Book> {

	@Override
	public int compare(Book arg0, Book arg1) {
		if (arg0.getDateOfReceipt().after(arg1.getDateOfReceipt())) {
			return 1;
		} else if (arg0.getDateOfReceipt().before(arg1.getDateOfReceipt())) {
			return -1;
		} else {
			return 0;
		}
	}
}
